<?php
namespace Common\Model;

use Think\Model;

class SystemStoreStatisticsModel extends \BaseModel
{
    /*********积分 金额更新*********/
    public function update_statistics($store_id, $field, $num)
    {
        $this->add_field($field);
        $r = $this->where("store_id='$store_id'")->setInc($field, $num);
        return $r;
    }


    /****add_field*****/
    public function add_field($field = "test")
    {
        $sql = "alter table system_store_statistics add {$field} int(11)  DEFAULT '0' ";
        $bool = false;
        if (!in_array($field, $this->fields)) {
            $this->query($sql);
            $bool = true;
        }
        if ($bool) {
            $this->flush();
        }
        return $field;
    }


}
 